package com.example;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import com.example.entity.User;
import com.example.service.UserService;
import com.example.util.RedisConfig;

@RunWith(SpringRunner.class)
//(classes = DemoApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@SpringBootTest
public class DemoApplicationTests {
    @Autowired
    UserService userService;
  
    @Autowired
    private RedisConfig redisConfig;
    
    @Test
    public void contextLoads() {
    	System.out.println("开启单元测试");
        User user = new User();
        user.setId("11");
        user.setName("springCach");
        user.setAge(21);
        userService.save(user);
        System.out.println("user:  " + user.toString());
//        Assert.assertEquals("success", "hello Spring Boot Test !", user.toString());
        redisConfig.getJedisCluster().set("wangbenyan", "王本燕");
        
    }

}
